<?php

$arr = [
	'/plugins/ueditor/dialogs/table/dragicon.png',
	'/plugins/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif',
];

$domain = 'http://xxx.com';

foreach ($arr as $key => $url) {
	echo $key . PHP_EOL;
    $pats = pathinfo($url);
    $dir = '.'.$pats['dirname'].'/';
      if(!is_dir($dir))
       {
        @mkdirs($dir, 0777);
       }
    $img = file_get_contents($domain.$url);
    file_put_contents('.'.$url,$img); 
}

function mkdirs($pathname, $mode = 0755){
 is_dir(dirname($pathname)) || mkdirs(dirname($pathname), $mode);
 return is_dir($pathname) || @mkdir($pathname, $mode);
}
